package com.example.client;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;
import java.io.IOException;

public class ClientLog {

    public static ObservableList<ClientData> clientDataList2 = FXCollections.observableArrayList();

    public ClientLog(){
        //增加几组数据
        clientDataList2.add(new ClientData("2022-9-1","20:27:10","30.2","46","480","362"));
        clientDataList2.add(new ClientData("2022-9-2","19:13:09","28.9","53","370","490"));
        clientDataList2.add(new ClientData("2022-9-3","23:56:13","25.0","61","432","387"));
    }

    /**
     * The data as an observable list of Persons.
     */
    public ObservableList<ClientData> getData(){
        return clientDataList2;
    }

    public void showMyData() throws IOException {
        FXMLLoader fxmlLoader = new FXMLLoader(Client.class.getResource("ClientLog.fxml"));
        Scene scene = new Scene(fxmlLoader.load(), 600, 400);
        Stage stage = new Stage();
        stage.getIcons().add(new Image(Client.class.getResource("logoCopy.png").toExternalForm()));
        stage.setTitle("备份数据");

        //给Controller控制该类的权限
        ClientLogController clientLogController = fxmlLoader.getController();
        clientLogController.setClientLog(this);

        stage.setScene(scene);
        stage.show();
    }

}
